<?php

namespace App\Http\Controllers\API;

use App\MyClass\ApiReturn;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Service\ArticleService;


class ArticleController extends Controller
{
    private $ArticleService;
    public function __construct(ArticleService $articleService)
    {
        $this->ArticleService = $articleService;
    }

    public function getSingleOne(Request $request)
    {
        $id = $request->get("id");
        $data = $this->ArticleService->get($id);
        return ApiReturn::Data('1',"获取成功",$data);
    }

    public function getAll(){
        $data = $this->ArticleService->all();
        return ApiReturn::Data('1',"获取成功",$data);
    }

}
